set_group(get_dir_basename(os.curdir()))
set_default(false)

function build_example(filename, packs)
    base_name = path.basename(filename)
    prefix = get_dir_basename(os.curdir()) .. '_'
    target_name = prefix .. base_name
    target(target_name)
        set_kind('binary')
        add_cxxflags('-std=c11 -x c')
        set_default('false')
        add_files(filename)
        add_packages(packs)
    target_end()
end

for _, file in ipairs(os.files('*.c')) do
    build_example(file, 'gtest_main')
end
